<template>
	<view>
		<view class="gui-margin-top">
			<gui-box-banner background="#F8F8F8" :items="items" @taped="taped"></gui-box-banner>
		</view>

		<view class="gui-margin-top" style="margin-left: 20rpx;">
			<text class="gui-h6 gui-color-red gui-bold">可提现金额：￥{{tixian_money}}</text>
		</view>

		<view class="gui-margin-top-large gui-flex gui-rows gui-nowrap gui-justify-content-end"
			style="margin-right: 40rpx;" v-if="tixian_money>0">
			<button type="default" class="gui-button gui-bg-blue" style="width:200rpx;" @tap="goto_tixian()">
				<text class="gui-icons gui-color-white gui-button-text">提现</text>
			</button>
			
		</view>

		<view class="gui-margin-top" style="width: 90%;margin-left: 20rpx;">
			<gui-empty v-if="lists==''">
				<view slot="img" class="gui-flex gui-rows gui-justify-content-center">
					<!-- 请根据您的项目要求制作并更换为空图片 -->
					<image class="gui-empty-img"
						:src="empty_img">
					</image>
				</view>
				<text slot="text" class="gui-text-small gui-block-text gui-text-center gui-margin-top"
					style="color:#9DABFF;">暂无数据</text>
			</gui-empty>

			<navigator class="gui-list-items" v-for="(item,index) in lists" :key="index">
				<text class="gui-list-icon gui-icons gui-color-blue">&#xe612;</text>
				<view class="gui-list-body gui-border-b">
					<view class="gui-list-title">
						<text class="gui-list-title-text gui-primary-color gui-list-one-line gui-ellipsis"
							style="width:320rpx; height:60rpx;">{{item.title}}</text>
					</view>
				</view>
				<text class="gui-list-arrow-right gui-icons gui-bold gui-color-green" style="width: 100rpx;"
					v-if="item.type==1">+￥{{item.money}}</text>
				<text class="gui-list-arrow-right gui-icons gui-bold gui-color-red" style="width: 100rpx;"
					v-if="item.type==2">-￥{{item.money}}</text>
			</navigator>

		</view>

	</view>

</template>

<script>
	export default {
		data() {
			return {
				tixian_money: 0,
				items: [
					[0, '元', '当月收入'],
					[0, '元', '今日收入'],
					[0, '元', '日平均收入'],
				],
				lists: "",
				empty_img:this.empty_img
			}
		},
		onLoad: function(query) {
			this.$globalMethod();
			this.shouru_center();
			this.shouru_list();
		},
		methods: {
			taped: function(idx) {
				console.log(idx);
			},
			shouru_center() {
				let _this = this;
				_this.graceJS.get(_this.serverUrl + '/api.shop/shouru_center', {}, {
						token: _this.token
					}, (res) => {
						if (res.code == 0) {
							_this.items[2][0] = res.data.day_avg_money;
							_this.items[1][0] = res.data.day_money;
							_this.items[0][0] = res.data.month_money;
							_this.tixian_money = res.data.tixian_money;
						} else {
							uni.showToast({
								title: res.msg,
								icon: 'none'
							})
						}
					},
					(e) => {

					})
			},
			goto_tixian(){
				uni.navigateTo({
					url:'/pages/shop/tixian'
				})
			},
			shouru_list() {
				let _this = this;
				_this.graceJS.get(_this.serverUrl + '/api.shop/user_shouru_list', {
						page: 1,
						page_size: 10
					}, {
						token: _this.token
					}, (res) => {
						if (res.code == 0) {
							_this.lists = res.data.list;
						} else {
							uni.showToast({
								title: res.msg,
								icon: 'none'
							})
						}
					},
					(e) => {

					})
			},
		}
	}
</script>

<style>
</style>